package com.baidu.mobstat;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.location.Location;
import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.telephony.CellLocation;
import android.telephony.TelephonyManager;
import android.telephony.gsm.GsmCellLocation;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;
import com.baidu.mobstat.a.a;
import com.baidu.mobstat.a.b;

final class q
{
  public static int a(Context paramContext)
  {
    Object localObject = new DisplayMetrics();
    try
    {
      DisplayMetrics localDisplayMetrics = j(paramContext);
      localObject = localDisplayMetrics;
      return ((DisplayMetrics)localObject).widthPixels;
    }
    catch (Exception localException)
    {
      b.a("createAdReqURL", localException);
    }
  }

  public static String a(Context paramContext, String paramString)
  {
    String str = "";
    PackageManager localPackageManager = paramContext.getPackageManager();
    Object localObject;
    try
    {
      ApplicationInfo localApplicationInfo = localPackageManager.getApplicationInfo(paramContext.getPackageName(), 128);
      if (localApplicationInfo != null)
      {
        Bundle localBundle = localApplicationInfo.metaData;
        localObject = null;
        if (localBundle != null)
          localObject = localApplicationInfo.metaData.get(paramString);
        if (localObject == null)
        {
          b.a("StatSDK", "null,can't find information for key:" + paramString);
          if (paramString == "BaiduMobAd_STAT_ID")
          {
            b.b("不能在manifest.xml中找到APP Key||can't find app key in manifest.xml.");
            throw new SecurityException("不能在manifest.xml中找到APP Key||can't find app key in manifest.xml.");
          }
        }
      }
    }
    catch (PackageManager.NameNotFoundException localNameNotFoundException)
    {
      if (paramString == "BaiduMobAd_STAT_ID")
      {
        b.b("不能在manifest.xml中找到APP Key||can't find app key in manifest.xml.");
        throw new SecurityException("不能在manifest.xml中找到APP Key||can't find app key in manifest.xml.");
        str = localObject.toString();
        if ((str.trim().equals("")) && (paramString == "BaiduMobAd_STAT_ID"))
        {
          b.b("APP Key值为空||The value of APP Key is empty.");
          throw new SecurityException("APP Key值为空||The value of APP Key is empty.");
        }
      }
    }
    return str;
  }

  // ERROR //
  public static String a(Context paramContext, String paramString1, String paramString2, int paramInt1, int paramInt2)
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore 5
    //   3: aload_0
    //   4: aload_1
    //   5: iload_3
    //   6: iload 4
    //   8: invokestatic 112	com/baidu/mobstat/a/a:a	(Landroid/content/Context;Ljava/lang/String;II)Ljava/net/HttpURLConnection;
    //   11: astore 6
    //   13: aload 6
    //   15: iconst_1
    //   16: invokevirtual 118	java/net/HttpURLConnection:setDoOutput	(Z)V
    //   19: aload 6
    //   21: iconst_0
    //   22: invokevirtual 121	java/net/HttpURLConnection:setUseCaches	(Z)V
    //   25: aload 6
    //   27: ldc 123
    //   29: ldc 125
    //   31: invokevirtual 129	java/net/HttpURLConnection:setRequestProperty	(Ljava/lang/String;Ljava/lang/String;)V
    //   34: aload 6
    //   36: invokevirtual 132	java/net/HttpURLConnection:connect	()V
    //   39: ldc 134
    //   41: invokestatic 136	com/baidu/mobstat/a/b:a	(Ljava/lang/String;)I
    //   44: pop
    //   45: new 66	java/lang/StringBuilder
    //   48: dup
    //   49: invokespecial 67	java/lang/StringBuilder:<init>	()V
    //   52: astore 8
    //   54: new 138	java/io/BufferedWriter
    //   57: dup
    //   58: new 140	java/io/OutputStreamWriter
    //   61: dup
    //   62: new 142	java/util/zip/GZIPOutputStream
    //   65: dup
    //   66: aload 6
    //   68: invokevirtual 146	java/net/HttpURLConnection:getOutputStream	()Ljava/io/OutputStream;
    //   71: invokespecial 149	java/util/zip/GZIPOutputStream:<init>	(Ljava/io/OutputStream;)V
    //   74: invokespecial 150	java/io/OutputStreamWriter:<init>	(Ljava/io/OutputStream;)V
    //   77: invokespecial 153	java/io/BufferedWriter:<init>	(Ljava/io/Writer;)V
    //   80: astore 9
    //   82: aload 9
    //   84: aload_2
    //   85: invokevirtual 156	java/io/BufferedWriter:write	(Ljava/lang/String;)V
    //   88: aload 9
    //   90: invokevirtual 159	java/io/BufferedWriter:close	()V
    //   93: new 161	java/io/BufferedReader
    //   96: dup
    //   97: new 163	java/io/InputStreamReader
    //   100: dup
    //   101: aload 6
    //   103: invokevirtual 167	java/net/HttpURLConnection:getInputStream	()Ljava/io/InputStream;
    //   106: invokespecial 170	java/io/InputStreamReader:<init>	(Ljava/io/InputStream;)V
    //   109: invokespecial 173	java/io/BufferedReader:<init>	(Ljava/io/Reader;)V
    //   112: astore 11
    //   114: aload 11
    //   116: invokevirtual 176	java/io/BufferedReader:readLine	()Ljava/lang/String;
    //   119: astore 12
    //   121: aload 12
    //   123: ifnull +44 -> 167
    //   126: aload 8
    //   128: aload 12
    //   130: invokevirtual 73	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   133: pop
    //   134: goto -20 -> 114
    //   137: astore 10
    //   139: aload 11
    //   141: ifnull +8 -> 149
    //   144: aload 11
    //   146: invokevirtual 177	java/io/BufferedReader:close	()V
    //   149: aload 5
    //   151: ifnull +8 -> 159
    //   154: aload 5
    //   156: invokevirtual 159	java/io/BufferedWriter:close	()V
    //   159: aload 6
    //   161: invokevirtual 180	java/net/HttpURLConnection:disconnect	()V
    //   164: aload 10
    //   166: athrow
    //   167: aload 11
    //   169: invokevirtual 177	java/io/BufferedReader:close	()V
    //   172: aload 6
    //   174: invokevirtual 180	java/net/HttpURLConnection:disconnect	()V
    //   177: iconst_2
    //   178: anewarray 4	java/lang/Object
    //   181: astore 14
    //   183: aload 14
    //   185: iconst_0
    //   186: ldc 182
    //   188: aastore
    //   189: aload 14
    //   191: iconst_1
    //   192: aload 6
    //   194: invokevirtual 186	java/net/HttpURLConnection:getResponseCode	()I
    //   197: invokestatic 192	java/lang/Integer:valueOf	(I)Ljava/lang/Integer;
    //   200: aastore
    //   201: aload 14
    //   203: invokestatic 195	com/baidu/mobstat/a/b:a	([Ljava/lang/Object;)I
    //   206: pop
    //   207: aload 6
    //   209: invokevirtual 186	java/net/HttpURLConnection:getResponseCode	()I
    //   212: sipush 200
    //   215: if_icmpeq +45 -> 260
    //   218: new 107	java/io/IOException
    //   221: dup
    //   222: new 66	java/lang/StringBuilder
    //   225: dup
    //   226: invokespecial 67	java/lang/StringBuilder:<init>	()V
    //   229: ldc 197
    //   231: invokevirtual 73	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   234: aload 6
    //   236: invokevirtual 186	java/net/HttpURLConnection:getResponseCode	()I
    //   239: invokevirtual 200	java/lang/StringBuilder:append	(I)Ljava/lang/StringBuilder;
    //   242: invokevirtual 76	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   245: invokespecial 201	java/io/IOException:<init>	(Ljava/lang/String;)V
    //   248: athrow
    //   249: astore 10
    //   251: aconst_null
    //   252: astore 11
    //   254: aconst_null
    //   255: astore 5
    //   257: goto -118 -> 139
    //   260: aload 8
    //   262: invokevirtual 76	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   265: areturn
    //   266: astore 10
    //   268: aload 9
    //   270: astore 5
    //   272: aconst_null
    //   273: astore 11
    //   275: goto -136 -> 139
    //
    // Exception table:
    //   from	to	target	type
    //   114	121	137	java/io/IOException
    //   126	134	137	java/io/IOException
    //   167	172	137	java/io/IOException
    //   54	82	249	java/io/IOException
    //   93	114	249	java/io/IOException
    //   172	249	249	java/io/IOException
    //   82	93	266	java/io/IOException
  }

  public static int b(Context paramContext)
  {
    Object localObject = new DisplayMetrics();
    try
    {
      DisplayMetrics localDisplayMetrics = j(paramContext);
      localObject = localDisplayMetrics;
      return ((DisplayMetrics)localObject).heightPixels;
    }
    catch (Exception localException)
    {
      b.a("createAdReqURL", localException);
    }
  }

  public static int c(Context paramContext)
  {
    PackageManager localPackageManager = paramContext.getPackageManager();
    String str = paramContext.getPackageName();
    try
    {
      int i = localPackageManager.getPackageInfo(str, 0).versionCode;
      return i;
    }
    catch (PackageManager.NameNotFoundException localNameNotFoundException)
    {
      b.b(new Object[] { "stat", "get app version code exception" });
    }
    return 1;
  }

  public static String d(Context paramContext)
  {
    PackageManager localPackageManager = paramContext.getPackageManager();
    String str1 = paramContext.getPackageName();
    try
    {
      String str2 = localPackageManager.getPackageInfo(str1, 0).versionName;
      return str2;
    }
    catch (PackageManager.NameNotFoundException localNameNotFoundException)
    {
      b.b(new Object[] { "stat", "get app version name exception" });
    }
    return "";
  }

  public static String e(Context paramContext)
  {
    Object[] arrayOfObject1 = new Object[3];
    arrayOfObject1[0] = Integer.valueOf(0);
    arrayOfObject1[1] = Integer.valueOf(0);
    arrayOfObject1[2] = Integer.valueOf(0);
    String str1 = String.format("%s_%s_%s", arrayOfObject1);
    try
    {
      if ((a.e(paramContext, "android.permission.ACCESS_FINE_LOCATION")) || (a.e(paramContext, "android.permission.ACCESS_COARSE_LOCATION")))
      {
        CellLocation localCellLocation = ((TelephonyManager)paramContext.getSystemService("phone")).getCellLocation();
        b.a("getLocation cell:", localCellLocation + "");
        if (localCellLocation == null)
          return str1;
        if (localCellLocation instanceof GsmCellLocation)
        {
          GsmCellLocation localGsmCellLocation = (GsmCellLocation)localCellLocation;
          Object[] arrayOfObject3 = new Object[3];
          Object[] arrayOfObject4 = new Object[1];
          arrayOfObject4[0] = Integer.valueOf(localGsmCellLocation.getCid());
          arrayOfObject3[0] = String.format("%d", arrayOfObject4);
          Object[] arrayOfObject5 = new Object[1];
          arrayOfObject5[0] = Integer.valueOf(localGsmCellLocation.getLac());
          arrayOfObject3[1] = String.format("%d", arrayOfObject5);
          arrayOfObject3[2] = Integer.valueOf(0);
          return String.format("%s_%s_%s", arrayOfObject3);
        }
        String[] arrayOfString = localCellLocation.toString().replace("[", "").replace("]", "").split(",");
        Object[] arrayOfObject2 = new Object[3];
        arrayOfObject2[0] = arrayOfString[0];
        arrayOfObject2[1] = arrayOfString[3];
        arrayOfObject2[2] = arrayOfString[4];
        String str2 = String.format("%s_%s_%s", arrayOfObject2);
        return str2;
      }
    }
    catch (Exception localException)
    {
      b.a("getLocation", localException);
    }
    return str1;
  }

  public static String f(Context paramContext)
  {
    try
    {
      if (a.e(paramContext, "android.permission.ACCESS_FINE_LOCATION"))
      {
        Location localLocation = ((LocationManager)paramContext.getSystemService("location")).getLastKnownLocation("gps");
        b.a("stat", "location: " + localLocation);
        if (localLocation != null)
        {
          Object[] arrayOfObject = new Object[3];
          arrayOfObject[0] = Long.valueOf(localLocation.getTime());
          arrayOfObject[1] = Double.valueOf(localLocation.getLongitude());
          arrayOfObject[2] = Double.valueOf(localLocation.getLatitude());
          String str = String.format("%s_%s_%s", arrayOfObject);
          return str;
        }
      }
    }
    catch (Exception localException)
    {
      b.a("stat", localException);
    }
    return "";
  }

  // ERROR //
  public static String g(Context paramContext)
  {
    // Byte code:
    //   0: aload_0
    //   1: ldc_w 323
    //   4: invokestatic 240	com/baidu/mobstat/a/a:e	(Landroid/content/Context;Ljava/lang/String;)Z
    //   7: ifeq +85 -> 92
    //   10: aload_0
    //   11: ldc_w 325
    //   14: invokevirtual 247	android/content/Context:getSystemService	(Ljava/lang/String;)Ljava/lang/Object;
    //   17: checkcast 327	android/net/wifi/WifiManager
    //   20: invokevirtual 331	android/net/wifi/WifiManager:getConnectionInfo	()Landroid/net/wifi/WifiInfo;
    //   23: astore 5
    //   25: aload 5
    //   27: invokevirtual 336	android/net/wifi/WifiInfo:getMacAddress	()Ljava/lang/String;
    //   30: astore 6
    //   32: aload 6
    //   34: astore_2
    //   35: iconst_2
    //   36: anewarray 4	java/lang/Object
    //   39: astore 7
    //   41: aload 7
    //   43: iconst_0
    //   44: aload 5
    //   46: invokevirtual 339	android/net/wifi/WifiInfo:getSSID	()Ljava/lang/String;
    //   49: aastore
    //   50: aload 7
    //   52: iconst_1
    //   53: aload 5
    //   55: invokevirtual 336	android/net/wifi/WifiInfo:getMacAddress	()Ljava/lang/String;
    //   58: aastore
    //   59: ldc_w 341
    //   62: aload 7
    //   64: invokestatic 235	java/lang/String:format	(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    //   67: invokestatic 136	com/baidu/mobstat/a/b:a	(Ljava/lang/String;)I
    //   70: pop
    //   71: aload_2
    //   72: areturn
    //   73: astore_1
    //   74: ldc 34
    //   76: astore_2
    //   77: aload_1
    //   78: astore_3
    //   79: ldc 216
    //   81: aload_3
    //   82: invokestatic 29	com/baidu/mobstat/a/b:a	(Ljava/lang/String;Ljava/lang/Throwable;)I
    //   85: pop
    //   86: aload_2
    //   87: areturn
    //   88: astore_3
    //   89: goto -10 -> 79
    //   92: ldc 34
    //   94: areturn
    //
    // Exception table:
    //   from	to	target	type
    //   0	32	73	java/lang/Exception
    //   35	71	88	java/lang/Exception
  }

  // ERROR //
  public static String h(Context paramContext)
  {
    // Byte code:
    //   0: iconst_0
    //   1: istore_1
    //   2: aload_0
    //   3: ldc_w 323
    //   6: invokestatic 240	com/baidu/mobstat/a/a:e	(Landroid/content/Context;Ljava/lang/String;)Z
    //   9: ifeq +353 -> 362
    //   12: aload_0
    //   13: ldc_w 325
    //   16: invokevirtual 247	android/content/Context:getSystemService	(Ljava/lang/String;)Ljava/lang/Object;
    //   19: checkcast 327	android/net/wifi/WifiManager
    //   22: astore 6
    //   24: aload 6
    //   26: invokevirtual 346	android/net/wifi/WifiManager:isWifiEnabled	()Z
    //   29: ifeq +333 -> 362
    //   32: ldc_w 348
    //   35: new 66	java/lang/StringBuilder
    //   38: dup
    //   39: invokespecial 67	java/lang/StringBuilder:<init>	()V
    //   42: aload 6
    //   44: invokevirtual 352	android/net/wifi/WifiManager:getScanResults	()Ljava/util/List;
    //   47: invokevirtual 258	java/lang/StringBuilder:append	(Ljava/lang/Object;)Ljava/lang/StringBuilder;
    //   50: ldc 34
    //   52: invokevirtual 73	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   55: invokevirtual 76	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   58: invokestatic 79	com/baidu/mobstat/a/b:a	(Ljava/lang/String;Ljava/lang/String;)I
    //   61: pop
    //   62: ldc_w 353
    //   65: istore 8
    //   67: iconst_m1
    //   68: istore 9
    //   70: iload_1
    //   71: aload 6
    //   73: invokevirtual 352	android/net/wifi/WifiManager:getScanResults	()Ljava/util/List;
    //   76: invokeinterface 358 1 0
    //   81: if_icmpge +91 -> 172
    //   84: aload 6
    //   86: invokevirtual 352	android/net/wifi/WifiManager:getScanResults	()Ljava/util/List;
    //   89: iload_1
    //   90: invokeinterface 361 2 0
    //   95: checkcast 363	android/net/wifi/ScanResult
    //   98: astore 19
    //   100: aload 19
    //   102: getfield 366	android/net/wifi/ScanResult:level	I
    //   105: invokestatic 372	java/lang/Math:abs	(I)I
    //   108: istore 20
    //   110: iconst_3
    //   111: anewarray 4	java/lang/Object
    //   114: astore 21
    //   116: aload 21
    //   118: iconst_0
    //   119: aload 19
    //   121: getfield 375	android/net/wifi/ScanResult:SSID	Ljava/lang/String;
    //   124: aastore
    //   125: aload 21
    //   127: iconst_1
    //   128: aload 19
    //   130: getfield 378	android/net/wifi/ScanResult:BSSID	Ljava/lang/String;
    //   133: aastore
    //   134: aload 21
    //   136: iconst_2
    //   137: iload 20
    //   139: invokestatic 192	java/lang/Integer:valueOf	(I)Ljava/lang/Integer;
    //   142: aastore
    //   143: ldc_w 380
    //   146: aload 21
    //   148: invokestatic 235	java/lang/String:format	(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    //   151: invokestatic 136	com/baidu/mobstat/a/b:a	(Ljava/lang/String;)I
    //   154: pop
    //   155: iload 8
    //   157: iload 20
    //   159: if_icmple +192 -> 351
    //   162: iload_1
    //   163: istore 23
    //   165: iload 20
    //   167: istore 24
    //   169: goto +196 -> 365
    //   172: iload 9
    //   174: iflt +170 -> 344
    //   177: aload 6
    //   179: invokevirtual 352	android/net/wifi/WifiManager:getScanResults	()Ljava/util/List;
    //   182: iload 9
    //   184: invokeinterface 361 2 0
    //   189: checkcast 363	android/net/wifi/ScanResult
    //   192: astore 10
    //   194: aload 10
    //   196: getfield 378	android/net/wifi/ScanResult:BSSID	Ljava/lang/String;
    //   199: ldc_w 382
    //   202: ldc 34
    //   204: invokevirtual 274	java/lang/String:replace	(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;
    //   207: invokevirtual 385	java/lang/String:toLowerCase	()Ljava/lang/String;
    //   210: astore 11
    //   212: iconst_2
    //   213: anewarray 4	java/lang/Object
    //   216: astore 12
    //   218: aload 12
    //   220: iconst_0
    //   221: aload 11
    //   223: aastore
    //   224: aload 12
    //   226: iconst_1
    //   227: aload 10
    //   229: getfield 366	android/net/wifi/ScanResult:level	I
    //   232: invokestatic 372	java/lang/Math:abs	(I)I
    //   235: invokestatic 192	java/lang/Integer:valueOf	(I)Ljava/lang/Integer;
    //   238: aastore
    //   239: ldc_w 387
    //   242: aload 12
    //   244: invokestatic 235	java/lang/String:format	(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    //   247: astore 13
    //   249: aload 13
    //   251: astore 14
    //   253: aload 6
    //   255: invokevirtual 331	android/net/wifi/WifiManager:getConnectionInfo	()Landroid/net/wifi/WifiInfo;
    //   258: astore 16
    //   260: iconst_3
    //   261: anewarray 4	java/lang/Object
    //   264: astore 17
    //   266: aload 17
    //   268: iconst_0
    //   269: aload 16
    //   271: invokevirtual 339	android/net/wifi/WifiInfo:getSSID	()Ljava/lang/String;
    //   274: aastore
    //   275: aload 17
    //   277: iconst_1
    //   278: aload 16
    //   280: invokevirtual 336	android/net/wifi/WifiInfo:getMacAddress	()Ljava/lang/String;
    //   283: aastore
    //   284: aload 17
    //   286: iconst_2
    //   287: aload 16
    //   289: invokevirtual 390	android/net/wifi/WifiInfo:getRssi	()I
    //   292: invokestatic 372	java/lang/Math:abs	(I)I
    //   295: invokestatic 192	java/lang/Integer:valueOf	(I)Ljava/lang/Integer;
    //   298: aastore
    //   299: ldc_w 392
    //   302: aload 17
    //   304: invokestatic 235	java/lang/String:format	(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    //   307: invokestatic 136	com/baidu/mobstat/a/b:a	(Ljava/lang/String;)I
    //   310: pop
    //   311: aload 14
    //   313: areturn
    //   314: astore_2
    //   315: aload_2
    //   316: astore_3
    //   317: ldc 34
    //   319: astore 4
    //   321: ldc_w 394
    //   324: aload_3
    //   325: invokestatic 29	com/baidu/mobstat/a/b:a	(Ljava/lang/String;Ljava/lang/Throwable;)I
    //   328: pop
    //   329: aload 4
    //   331: areturn
    //   332: astore 15
    //   334: aload 14
    //   336: astore 4
    //   338: aload 15
    //   340: astore_3
    //   341: goto -20 -> 321
    //   344: ldc 34
    //   346: astore 14
    //   348: goto -95 -> 253
    //   351: iload 9
    //   353: istore 23
    //   355: iload 8
    //   357: istore 24
    //   359: goto +6 -> 365
    //   362: ldc 34
    //   364: areturn
    //   365: iinc 1 1
    //   368: iload 24
    //   370: istore 8
    //   372: iload 23
    //   374: istore 9
    //   376: goto -306 -> 70
    //
    // Exception table:
    //   from	to	target	type
    //   2	62	314	java/lang/Exception
    //   70	155	314	java/lang/Exception
    //   177	249	314	java/lang/Exception
    //   253	311	332	java/lang/Exception
  }

  public static String i(Context paramContext)
  {
    NetworkInfo localNetworkInfo = ((ConnectivityManager)paramContext.getSystemService("connectivity")).getActiveNetworkInfo();
    String str = localNetworkInfo.getTypeName();
    if ((!str.equals("WIFI")) && (localNetworkInfo.getSubtypeName() != null))
      str = localNetworkInfo.getSubtypeName();
    return str;
  }

  public static DisplayMetrics j(Context paramContext)
  {
    DisplayMetrics localDisplayMetrics = new DisplayMetrics();
    ((WindowManager)paramContext.getApplicationContext().getSystemService("window")).getDefaultDisplay().getMetrics(localDisplayMetrics);
    return localDisplayMetrics;
  }
}

/* Location:           C:\Users\god\Desktop\liunianjishiben_V1.1_mumayi_3745b_dex2jar.jar
 * Qualified Name:     com.baidu.mobstat.q
 * JD-Core Version:    0.5.4
 */